<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>无需Flash无需依赖任何JS库实现文本复制与剪切</title>
<script src="../jquery.min.js"></script>
<script src="clipboard.min.js"></script>

</head>

<body>

<div id="main">

	<div class="demo">

		<a class='jsclip' href="javascript:;" data-url="http://www.baidu.com">复制</a>
		
	</div>

</div>

<script>
   var clipboard = new Clipboard('.jsclip', {
   text: function(e) {
    return $(e).data('url')||$(e).data('href');
    }
   });
   clipboard.on('success', function(e) {
   alert('复制成功');
   
   });
</script>


</body>
</html>